package com.mtons.mblog.modules.repository;

import com.mtons.mblog.modules.entity.LearnPlan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @author leicongwu
 */
public interface LearnPlanRepository extends JpaRepository<LearnPlan, String>, JpaSpecificationExecutor<LearnPlan> {

    @Modifying
    @Query(value = "update learn_plan set  send_email_status=?1 where id=?2 and send_email_status='0' ", nativeQuery = true)
    int updateEmailStatusById(String status, String id);

    @Modifying
    @Query(value = "update learn_plan set  score=?2 where id=?1 and score='-1'", nativeQuery = true)
    int updateScoreById(String id, String score);

    @Modifying
    @Query(value = "update learn_plan set  remind_status='1' where id=?1 and remind_status='0'", nativeQuery = true)
    int updateRemindStatusId(String id);
}
